import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const state = new Vuex.Store({
  state: {
    authed: false,
    user: {},
    token: "",
    eventId:"8a838a2070af390f0170b914c0af0027",
    top:false,
    menus:[],
    roleCodes:[]
  },
  mutations: {
    userLogout: function (state) {
      state.authed = false;
      state.user = {};
      state.token = "";
      state.top=false;
      state.menus=[];
      state.roleCodes=[];
    },
    setUserInfo: function (state, user) {
      console.log(user)
      state.user = user;
      state.token= user.token;
    },
    setMenuPriv: function(state,menu) {
      console.log(menu)
      state.menus=menu;
    }
  }
});

export default state;
